<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


//前台
Route::group(['namespace' => 'Home'], function () {
	Route::get('/', 'IndexController@index');
});


//后台登录
Route::controller('admin/enter', 'Admin\LoginController');

//后台
Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => ['auth', 'permission:admin']], function () {

	Route::get('/', 'IndexController@index');

	Route::any('user/assign_role/{id}', 'UserController@AssignRole')->where('id','[0-9]+');
	Route::get('user/lock/{id}/{lock}', 'UserController@lock');
	Route::resource('user', 'UserController');

	Route::any('role/assign_permission/{id}', 'RoleController@AssignPermission')->where('id','[0-9]+');
	Route::resource('role', 'RoleController');

	Route::resource('permission', 'PermissionController');

	Route::resource('category', 'CategoryController');

	Route::get('log/UserLoginRecords', 'UserActionLogController@UserLoginRecords');

});


//登录&注册
Route::group(['prefix' => 'auth', 'namespace' => 'Auth'], function () {

	Route::controller('login', 'LoginController');

	Route::controller('register', 'RegisterController');

});